Subject: Re: Extensions
From: Branko Collin <[email-masked]>
To: Andy Church Andy Church<[email-masked]>
Cc: [email-masked]
Date: Thu, 28 Dec 1995 15:51:47 +0100 (MET)

On Mon, 25 Dec 1995, Andy Church wrote:

> >How does one go about making an extension?  I want one to read the CD32 
> >pads.  I already have the C source to do so.  What has to be done to make 
> >it into a couple of commands like Read CD32(1) and Read CD32(2)?
> 
>   Oy.  That is a complicated process.  I'd suggest you start off by looking
> at the source for the Music extension, and go from there.  That's how I
> learned, anyway.

How do you know how the Amos tokeniser works? Trial and error? 

I have written a tokeniser in LEX for a small subset of Amos (don't ask 
me what for, as it's much to early to tell :-)). Here it is, for those 
interested:

NC	[A-Z_]+
LNC	[A-Z][A-Z_]*
CM	"Print Using"|"Print #"|"Print"|"For"|"To"|"Next"|"If"|"Then"|"Else"|"Endif" 
OP	"+"|"-"|"="
%%
_{NC}"$(".*")"		; { printf("String array: %s\n",yytext); }
_{NC}"$"		; { printf("String var:   %s\n",yytext); }
_{NC}#\(.*\)		; { printf("Real array:   %s\n",yytext); }
_{NC}#			; { printf("Real:         %s\n",yytext); }
_{NC}\[.*\]		; { printf("Procedure:    %s\n",yytext); }
_{NC}\(.*\)		; { printf("Int array:    %s\n",yytext); }
_{NC}			; { printf("Int:          %s\n",yytext); }
{CM}			; { printf("Command:      %s\n",yytext); }
{LNC}"$(".*")"		; { printf("String array: %s\n",yytext); }
{LNC}"$"		; { printf("String var:   %s\n",yytext); }
{LNC}"#(".*")"		; { printf("Real Array:   %s\n",yytext); }
{LNC}#			; { printf("Real var:     %s\n",yytext); }
{LNC}"(".*")"		; { printf("Int Array:    %s\n",yytext); }
{LNC}			; { printf("Int Var:      %s\n",yytext); }
"\"".+"\""		; { printf("String const: %s\n",yytext); }
[0-9]+			; { printf("Int const:    %s\n",yytext); }
{OP}			; { printf("Operator:     %s\n",yytext); }
[^ \n]			; { printf("Error:        %s\n",yytext); }
[ \t]+			;
[\n]			;
%%

.......................................................................
.       Branko Collin          .                                      .
.                              .                                      .
.   //  [email-masked]  .                                      .
. \X/   [email-masked]         .                                      .
.......................................................................